<template>
  <div class="container">
    <el-button type="" @click="$router.back()">返回</el-button>

    <h1 class="title">{{blog.title}}</h1>

    <div class="content">
      <div v-html="blog.content"></div>
    </div>
  </div>
</template>

<script>
export default {
    data () {
        return {
            id: 0,
            blog: {} 
        }
    },
    created() {
        this.id = this.$route.query.id;
        this.handlerGetData()
    },
    methods: {
      async handlerGetData() {
        let {data} = await this.$req.get({
          url: '/detail',
          data:{
            id: this.id,
          }
        })
        if (data.code == 200) {
          this.blog = data.data
        }
      }
    },
}
</script>

<style lang="scss" scoped>
.container {
  box-sizing: border-box;
  background-color: #fadddd;
  max-width: 900px;
  min-height: 100vh;
  padding:20px;
  margin: 0 auto;
  .content {
    width: 100%;
    overflow: auto;
  }
  .content img {
    max-width: 100%;
  }
}
</style>